package com.liuhm.dianjuhe.bean;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author liuhaomin
 * @date 2020/9/14
 */

public class Cluster implements Serializable {

    private static final long serialVersionUID = -5395248007484149223L;
    /** 该聚合点中心位置 */
    private LatLng mLatLng;
    /** 该聚合点的子集 */
    private List<ClusterItem> mClusterItems;
    private int count;
    /** 该聚合点方格范围 */
    @JsonIgnore
    private LatLngBounds latLngBounds;
    public Cluster() {
    }

    public Cluster(LatLng latLng) {
        mLatLng = latLng;
        mClusterItems = new ArrayList<ClusterItem>();
        latLngBounds=new LatLngBounds();
        count=0;
    }
    public void addCount() {
        count++;
    }
    public LatLngBounds getLatLngBounds() {
        return latLngBounds;
    }

    public void setLatLngBounds(LatLngBounds latLngBounds) {
        this.latLngBounds = latLngBounds;
    }

    public void addClusterItem(ClusterItem clusterItem) {
        mClusterItems.add(clusterItem);
    }

    int getClusterCount() {
        return mClusterItems.size();
    }

    public List<ClusterItem> getmClusterItems() {
        if(count==1){
            return mClusterItems;
        }else{
            return null;
        }
    }

    public void setmClusterItems(List<ClusterItem> mClusterItems) {
        this.mClusterItems = mClusterItems;
    }

    public LatLng getCenterLatLng() {
        return mLatLng;
    }

    List<ClusterItem> getClusterItems() {
        return mClusterItems;
    }

    public int getCount() {
        if(count!=0){
            return count;
        }
        return mClusterItems.size();
    }
}
